<div class="container">
    <div ng-controller="userManageController">
        <div class="row">
            <div class="col-sm-12">
                <form class="form-inline">
                    <div class="form-group">
                        <button type="button" class="btn btn-success btn-sm" location-go="/business/user/create">新建用户</button>
                    </div>
                </form>
                <br/>
                <form class="form-inline">
                    <div class="form-group">
                        <input name="userName" type="text" class="form-control input-sm" ng-model="searchRequest.userName" placeholder="用户名"/>
                    </div>
                    <div class="form-group">
                        <select name="isDisable" ng-model="searchRequest.isDisable" ng-options="option.isDisable as option.name for option in isDisableOptions" class="form-control input-sm" required>
                            <option value="">--状态--</option>
                        </select>
                    </div>
                    <div class="form-group">
                        <select name="isDeveloper" ng-model="searchRequest.isDeveloper" ng-options="option.isDeveloper as option.name for option in isDeveloperOptions" class="form-control input-sm" required>
                            <option value="">--角色--</option>
                        </select>
                    </div>
                    <div class="form-group">
                        <button type="button" class="btn btn-info btn-sm" ng-click="search({'page':1});">搜索</button>
                    </div>
                </form>
                <br/>
            </div>
        </div>
        <div class="row">
            <div class="col-sm-12">
                <table class="table table-condensed table-hover">
                    <thead>
                    <tr class="active">
                        <th width="30" align="center">#</th>
                        <th width="150">ID<span class="glyphicon glyphicon-sort-by-attributes-alt text-info" aria-hidden="true"></span></th>
                        <th width="150">用户名</th>
                        <th width="100">状态</th>
                        <th width="100">角色</th>
                        <th width="100">登录次数</th>
                        <th width="100">创建者</th>
                        <th width="150">创建日期</th>
                        <th width="150">修改日期</th>
                        <th>操作</th>
                    </tr>
                    </thead>
                    <tbody>
                    <tr ng-repeat="user in pagerResult.records track by $index">
                        <th>{{$index + 1}}</td>
                        <td>{{user.id}}</td>
                        <td>{{user.userName}}</td>
                        <td>{{user.isDisable ? "冻结" : "激活"}}</td>
                        <td>{{user.isDeveloper ? "开发者" : "使用者";}}</td>
                        <td>{{user.loginCount}}</td>
                        <td>{{user.creator ? user.creator.userName : '系统'}}</td>
                        <td>{{user.createDate | date : "yyyy-MM-dd HH:mm:ss"}}</td>
                        <td>{{user.modifyDate | date : "yyyy-MM-dd HH:mm:ss"}}</td>
                        <td>
                            <div class="btn-group">
                                <button type="button" class="btn btn-info btn-sm" location-go="/business/user/detail/{{user.id}}">详情</button>
                                <button type="button" ng-disabled="!user.creator" class="btn btn-info btn-sm dropdown-toggle" data-toggle="dropdown" aria-haspopup="true" aria-expanded="false"><span class="caret"></span></button>
                                <ul class="dropdown-menu">
                                    <li ng-class="{'disabled':!user.creator}"><a href="javascript:void(0);" location-go="/business/user/update/{{user.id}}">修改</a></li>
                                    <li ng-class="{'disabled':!user.creator}"><a href="javascript:void(0);" ng-click="enableOrDisable(user)">{{user.isDisable ? "激活" : "冻结"}}</a></li>
                                    <li ng-class="{'disabled':!user.creator}"><a href="javascript:void(0);" ng-click="passwordReset(user)">重置密码</a></li>
                                </ul>
                            </div>
                        </td>
                    </tr>
                    </tbody>
                </table>
            </div>
        </div>
        <div>
            <div class="pull-left">
                <ul class="pagination pagination-sm">
                    <li ng-class="{'active': searchRequest.pageSize==pageSize}" ng-repeat="pageSize in [10, 20, 50]" ><a href="javascript:void(0);" ng-click="(searchRequest.pageSize!=pageSize)&&search({'pageSize':pageSize,'page':1});">{{pageSize}}</a></li>
                </ul>
            </div>
            <div class="pull-left">
                &nbsp;
                <uib-pagination class="pagination-sm" boundary-links="true" rotate="false" max-size="10" total-items="pagerResult.total" ng-model="searchRequest.page" ng-change="search();" items-per-page="searchRequest.pageSize" first-text="首页" previous-text="上页" next-text="下页" last-text="尾页"></uib-pagination>
            </div>
            <div class="pull-left form-control-static clearfix">&nbsp;共&nbsp;{{pagerResult.total ? pagerResult.total : 0}}&nbsp;条</div>
        </div>
    </div>
</div>